Skip to content

Conversation

@rgrinberg
Copy link
Member

As described here #12570

@rgrinberg rgrinberg force-pushed the cram-setup-script branch 3 times, most recently from 4891c5b to 8c98da5 Compare November 1, 2025 16:03
Signed-off-by: Rudi Grinberg <[email protected]>
Signed-off-by: Rudi Grinberg <[email protected]>

refactor: my personal tweaks

Signed-off-by: Rudi Grinberg <[email protected]>
@rgrinberg rgrinberg marked this pull request as ready for review November 6, 2025 23:30
@rgrinberg rgrinberg added the cram Related to the cram test execution in Dune label Nov 9, 2025
@rgrinberg
Copy link
Member Author

ping @Alizter

Copy link
Collaborator

@Alizter Alizter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions:

  1. What happens with duplicate scripts?
  2. If the sourced script exists or times out, what happens?
  3. We parse a location in the stanza, do we use it or intend to?

@rgrinberg
Copy link
Member Author

  • What happens with duplicate scripts?

I'll deduplicate them.

  • If the sourced script exists or times out, what happens?

We could add some code to detect such scripts timing out to give a proper error message. Don't think this is essential.

  • We parse a location in the stanza, do we use it or intend to?

I'll get rid of it. I used it in an earlier version where I didn't allow for external paths.

Copy link
Collaborator

@Alizter Alizter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also have a test that shows changing the helper script after running a test triggers a rebuild. (i.e. it is registered as a dep). I want to be certain the helper script appears in the relevant digests.


$ cat > dune-project << EOF
> (lang dune 3.21)
> (cram enable)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> (cram enable)


$ cat > dune-project << EOF
> (lang dune 3.21)
> (cram enable)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> (cram enable)


$ cat > dune-project << EOF
> (lang dune 3.21)
> (cram enable)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> (cram enable)


$ cat > dune-project << EOF
> (lang dune 3.21)
> (cram enable)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> (cram enable)


$ cat > dune-project << EOF
> (lang dune 3.21)
> (cram enable)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> (cram enable)


$ cat > dune-project << EOF
> (lang dune 3.21)
> (cram enable)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> (cram enable)


Run the test:

$ dune runtest
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this test fail so that we can see it has run.

> show_final exists
> EOF

Run tests to see the actual behavior:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not seeing the actual order here? Perhaps you meant to promote and cat afterwards?

@Alizter
Copy link
Collaborator

Alizter commented Nov 16, 2025

Also can you move the tests to cram/setup-scripts rather than cram-setup-scripts.

@Alizter Alizter self-requested a review November 16, 2025 16:18
@rgrinberg
Copy link
Member Author

Can we also have a test that shows changing the helper script after running a test triggers a rebuild. (i.e. it is registered as a dep). I want to be certain the helper script appears in the relevant digests.

Given that the cram tests are sandboxed, the fact that setup script is copied to the sandbox should already be evidence we are depending on it.

@Alizter
Copy link
Collaborator

Alizter commented Nov 16, 2025

Another potential issue I see, and this one is a bit pathological, is having two scripts script_a.sh and script_b.sh and script_a.sh does something like chmod -r script_b.sh which causes the later remove to fail.

Obviously users doing this are being silly, but I'm interested in what error message we get. It's probably not worth being resilient against since there are plenty of other ways to break dune. The point I'm trying to make here is what happens when the script cleanup goes wrong.

Copy link
Collaborator

@Alizter Alizter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pointed some things out but they are not critical. The rest looks fine to me. We will likely find any teething pains when we start using it ourselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cram Related to the cram test execution in Dune

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants